package com.zzptc.zzsgz.bdsjws.fragments;

import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.zzptc.zzsgz.bdsjws.R;
import com.zzptc.zzsgz.bdsjws.activities.FamilysosActivity;
import com.zzptc.zzsgz.bdsjws.fragments.base.BaseFragmentbase;
import com.zzptc.zzsgz.bdsjws.fragments.base.SecondFragment;

import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/5/27.
 */

public class FirstFragment extends BaseFragmentbase{
    @BindView(R.id.btn_sos)
   Button btn_sos;
    @Override
    public int getXml() {
        return R.layout.first_fragment;
    }

    @Override
    public void initView() {
        //开启一键求救
        getThisView().findViewById(R.id.btn_sos).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (getActivity()instanceof FamilysosActivity){
////调用activity的一个方法  到第二个Fragment
           ((FamilysosActivity) getActivity()).toSecondFragment();
                }
            }
        });
    }

    @Override
    public void initData() {

    }


//    @OnClick(R.id.btn_sos)
//    public void onViewClicked(View view){
//        Toast.makeText(getActivity(), "=======", Toast.LENGTH_SHORT).show();
//        //getFragmentManager().beginTransaction().hide().add(R.id.fl_sos,new SecondFragment()).commit();
//        //首先要获取宿主activity
//       if (getActivity()instanceof FamilysosActivity){
////调用activity的一个方法  到第二个Fragment
//           ((FamilysosActivity) getActivity()).toSecondFragment();
//       }
//
//    }
}
